#ifndef FUNCTIONS_H
#define FUNCTIONS_H
#pragma once
#include <cv.h>
#include <highgui.h>
#include <iostream>
#include "StereoX/Stereo.h"
#include <stdio.h>
#include <stdlib.h>


using namespace System;
using namespace Stereo;
/*
int LoadImageFile(char *imageName,IplImage **im);
void DisplayImage(char* NameWindow,IplImage* image);
void HoldImages(void);
void CleanAndDestroy(char* NameWindow,IplImage* image);
void LocateCornersInArray(IplImage* corners,CvPoint CornerPoint[],int* CornersNbr);
*/
class GlobalFunctions
{
public :
	static IplImage* LoadImageFile(char* imageName);
	static  void DisplayImage(char* NameWindow,IplImage* image);
	static  void HoldImages(void);
	static  void CleanAndDestroy(char* NameWindow,IplImage* image);
	static  void LocateCornersInArray(IplImage* corners,CvPoint CornerPoint[],double cornerValuePoint[],int *CornersNbr);
	static  void GetImageCorners(const IplImage* im, CvPoint CornerPoint[],double cornerValuePoint[], int *CornersNbr);
	static  void MarkCorners(CvPoint CornerPoints[], IplImage** original,int NbrCorners);
	static  void MarkCornersWithNumbers(vector<CvPoint> CornerPoints, IplImage** original,int NbrCorners);
	static  double* QuickSort(double* a, int i, int j, CvPoint CornerPoints[]);
	static  int Partition(double* a, int p, int r,  CvPoint CornerPoints[]);
	static void MarkRect(IplImage **original, CvRect rect);
	
	
	// Calibrates the camera and get the parameters (see more details on definition of the method)
	 static CameraParameters CalibCamVideo(char* videopath, int intervalframes,CvSize grid, float squareSize);
	 static CameraParameters CalibCamImages(char* imagespath, int numimg, CvSize grid, float squareSize);

	 static void GlobalFunctions::setOdometerPos(float *camPositions,char* camPositionsFile, int row, int col ); 


	
private :
		GlobalFunctions();
		~GlobalFunctions();
};


#endif